package apis

import (
	"context"
	"github.com/kataras/iris/v12"
	"github.com/wutianze/nats.go"
	db2 "gluenet/internal/glue-datasyncer/db"
	"gluenet/pkg/log/v1"
	"gluenet/pkg/nets"
	"gluenet/pkg/ops/dbi"
	"net/http"
	"sync"
)

type StorageContext struct {
	//Env map[string]string

	Context    context.Context
	RpcContext *nets.NetContext
	WebContext iris.Context

	Logger v1.Logger
	Rpc    nets.GlueNets

	DataBase dbi.GlueDB
	Nats     *nats.Conn
	//Web      *iris.Application
	//PrometheusUrl string
	DB *db2.DB

	MetricsSubscriber      *sync.Map
	MetricsSubscriberTotal *sync.Map

	StatusSubscriber      *sync.Map
	StatusSubscriberTotal *sync.Map

	InfoFlusher *Gflush

	MetricCache *sync.Map
	StateCache  *sync.Map

	MetricsChan   chan []byte
	MetricSubChan *sync.Map
	MetricLabels  *sync.Map

	LogsChan     chan []byte
	LogsSubChan  *sync.Map
	LogsProducer *sync.Map

	ConfigMapUpdater func(map[string]interface{}, string) error
	ConfigMapGeter   func(string) (map[string]interface{}, error)
	ConfigReload     func() error

	ResponseWriter http.ResponseWriter
	ResquestReader *http.Request

	ReciverServer *http.Server
	AppServer     *iris.Application
}
